package java006;

import java.util.HashMap;
import java.util.Scanner;

public class zuoye07 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		System.out.println("");
		String s1 = sc.next();
		String s2 = sc.next();
		char[] ch1 = s1.toCharArray();
		char[] ch2 = s2.toCharArray();
		HashMap<Character,Integer> map = new HashMap<>();
		for(char c: ch1){
			if(map.containsKey(c)){
				map.put(c, map.getOrDefault(c, 0) + 1);
			}else{
				map.put(c, 1);
			}
		}
		System.out.println("");
		int flag = 0;
		for(char c: ch2){
			if(map.containsKey(c)){
				int value = map.get(c);
				value--;
				map.put(c, value);
				if(value < 0){
					System.out.println("NO");
					flag = 1;
					break;
				}
			}else{
				System.out.println("NO");
				flag = 1;
				break;
			}
		}
		int value = 0;
		if(flag == 0){
			for(Character c: map.keySet()){
				value = value + map.get(c);
			}
			System.out.println("YES "+value);
		}
	}
}